import request from '@/utils/request';

export function saveManufacturer(params:any){
  return request('/xwyl/manufacturer/saveManufacturer', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export function manufacturerData(){
  return request('/xwyl/manufacturer/manufacturerData', {
    method: 'POST',
    requestType:'form',
  });
}

export function userListData(params: any) {
  var data =  request('/xwyl/user/userListData', {
    method: 'POST',
    params,
  });
  return data;
}

export function roleListData() {
  var data =  request('/xwyl/role/roleListData', {
    method: 'POST',
  });
  return data;
}

export function saveUser(params:any) {
  var data =  request('/xwyl/user/saveUser', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}

export function updateUser(params:any) {
  var data =  request('/xwyl/user/updateUser', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}

export function deleteUser(params:any) {
  var data =  request('/xwyl/user/delete', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}

export function getSysLogList(params: any) {
  var data =  request('/xwyl/sysLog/getSysLogList', {
    method: 'POST',
    params,
  });
  return data;
}

export function findMenuById(params: any) {
  var data =  request('/xwyl/menu/findMenuById', {
    method: 'POST',
    params,
  });
  return data;
}

export function findMenu(params: any) {
  var data =  request('/xwyl/menu/findAllMenu', {
    method: 'POST',
    params,
  });
  return data;
}


export function removeMenu(params:any) {
  var data =  request('/xwyl/menu/removeMenu', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}


export function addMenu(params:any){
  return request('/xwyl/menu/addMenu', {
    method: 'post',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params
    },
  });
}

export function editMenu(params:any){
  return request('/xwyl/menu/editMenu', {
    method: 'post',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params
    },
  });
}


export function updateUserFactory(params:any) {
  var data =  request('/xwyl/user/updateUserFactory', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}
